<?php
if(Yii::app()->user->isGuest){
	echo CHtml::tag('div',array('class'=>'inlineError'),CHtml::link(Yii::t('default','signin_first'),Yii::app()->createUrl('/users/login')));
}else if($ad->status != Ad::STATUS_ACTIVE){
	echo CHtml::tag('div',array('class'=>'inlineError'),Yii::t('copy','dormant_status_ad'));
}else if($ad->details->quiz_able){
	?>
	<div class="solveQuiz">
		<?php echo CHtml::form(Yii::app()->createUrl('slogans/solvequiz',array('ad_id'=>$ad->id)));?>
		<table>
			<tbody>
				<tr valign="top" height="40px">
					<td width="80px" class="title"></td>
					<td width="50px"><?=Yii::t('copy','quiz')?></td>
					<td width="410px" class="quiz"><?=$ad->details->quiz?></td>
				</tr>
				<tr>
				<td> </td>
				<td><?=Yii::t('copy','answer')?></td>
				<td class="answer">
					<div class="errorMsg"></div>
					<?php echo CHtml::textField('answer','',array('id'=>'answer','class'=>'float-left'));
					echo CHtml::submitButton(Yii::t('default', 'submit'),array('id'=>'sendAnswer','class'=>'float-left btn-s btn-dark'));
					?>
				</td>
				</tr>
			</tbody>
		</table>
		<?php echo CHtml::endForm();?>
	</div>
<?
}else{
?>
	<div class="writeCopy">
		<?php echo CHtml::form(Yii::app()->createUrl('slogans/write',array('ad_id'=>$ad->id)),'post',array('id'=>'SloganWriteForm'));?>
		<div class="header">
			<div class="float-left text-with-icon-12 mg-t-5">
				<i class="tag-icon-12"></i><?=Yii::t('copy','keyword');?>
			</div>
			<div max="100" class="charCounter float-right" style="color: rgb(102, 102, 102);">100</div>
		</div>
		<div class="input text">
			<?php echo CHtml::textArea('slogan','',array('id'=>'SloganSlogan','placeholder'=>'Write a slogan here!','cols'=>'30','rows'=>'3'));?>
		</div>
		<div class="footer overhidden">
			<div class="errorMsg"></div>
			<div class="writerInfo"></div>
			<div class="float-left publishNow">
				<?php echo CHtml::checkBox('direct',array('id'=>'SloganDirect','checked'=>'checked','value'=>'1'));
				echo '&nbsp;'.Yii::t('copy', 'publish_now');?>
			</div>
			<?php echo CHtml::submitButton(Yii::t('default', 'submit'),array('class'=>'publish float-right btn btn-dark','style'=>'display: block;'));?>
			<div class="publishLoading float-right" style="display: none;"></div>
		</div>
		<?php echo CHtml::endForm();?>
	</div>
<?	
}
